
@echo off

cls

            set START_CD=%CD%

            cd ..\gae
            set GAE_ROOT=%CD%
            cd %START_CD%

echo .
echo .
echo .      Generating the automated source code
echo .      ====================================
echo .
            cd icani.codegeneration
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO DOMAIN_MODEL
            
            
:DOMAIN_MODEL
echo .
echo .
echo .      Compiling the Domain Model
echo .      ==========================
echo .
            cd icani.domainmodel
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO DATA_MODEL


:DATA_MODEL
echo .
echo .
echo .      Compiling the Data Model
echo .      ========================
echo .
            cd icani.datamodel
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO EVENT_MODEL


:EVENT_MODEL
echo .
echo .
echo .      Compiling the Event Model
echo .      =========================
echo .
            cd icani.eventmodel
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO SERVICE_MODEL


:SERVICE_MODEL
echo .
echo .
echo .      Compiling the Service Model
echo .      ===========================
echo .
            cd icani.servicemodel
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO CORE


:CORE
echo .
echo .
echo .      Compiling the Core Project
echo .      ==========================
echo .
            cd icani.core
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO WEB_INTERFACE_GAE


:WEB_INTERFACE_GAE
echo .
echo .
echo .      Compiling the Web Interface for GAE
echo .      ===================================
echo .
            cd icani.web-interface-gae
            
            call compile.cmd 
            
            IF %ERRORLEVEL% NEQ 0 GOTO ERROR_HANDLER
            
            cd ..
            
            GOTO QUIT_NORMAL

            
:ERROR_HANDLER
echo .
echo .
echo .      M: Error occured!
echo .
echo .
            GOTO QUIT_ERROR

            
:QUIT_ERROR
echo .
echo .
echo .      M: Compile all aborted due error
echo .
echo . 
            GOTO QUIT

            
:QUIT_NORMAL
echo .
echo .
echo .      M: Compile all done normal
echo .
echo . 
            GOTO QUIT

            
:QUIT
            cd %START_CD%